package com.gwq.controller;

import com.gwq.entity.User;
import com.gwq.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Administrator
 * @version 1.0
 * @description TODO
 * @date 2024/7/25 14:19
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/selectAllUser")
    public List<User> selectAllUser() {
        return userService.selectAllUser();
    }

    @GetMapping("/testAdd")
    public String testAdd() {
        User user = new User();
        user.setName("张三");
        user.setSex(1);
        user.setAge(20);
        user.setAddr("湖南长沙");
        userService.saveUser(user);
        return "Ok";
    }

}
